import Vue from 'vue'
import VueRouter from 'vue-router'

import myFilms from '@/views/myFilms.vue'
import comingSoon from '@/components/Films/ComingSoon/ComingSoon.vue'
import nowPlaying from '@/components/Films/NowPlaying/NowPlaying.vue'

import myCinemas from '@/views/myCinemas.vue'
import myCenter from '@/views/myCenter.vue'
import Detail from '@/views/myDetail.vue'
import myCity from '@/views/myCity.vue'
import mySearch from '@/views/mySearch'
Vue.use(VueRouter)

const routes = [
  {
    path: '/films',
    component: myFilms,
    children: [
      {
        path: '/films/comingsoon',
        component: comingSoon
      },
      {
        path: '/films/nowplaying',
        component: nowPlaying
      },
      {
        // path:'/',
        path: '/films',
        redirect: '/films/nowplaying'
      }
    ]
  },
  {
    path: '/detail/:myid',
    component: Detail
  },
  {
    path: '/cinemas',
    component: myCinemas
  },
  {
    path: '/cinemas/search',
    component: mySearch
  },
  {
    path: '/city',
    component: myCity
  },
  {
    path: '/center',
    component: myCenter
  },
  {
    path: '*',
    redirect: '/Films'
  }
]
const router = new VueRouter({
  mode: 'history', // hash 模式  (#/films)    history模式 (/films)
  routes
})
export default router
